/*
    学生编号、姓名初始化。
    因为需要每台小车分配给每名同学，所以假设学生和小车数量相等
*/
#include "../include/student.h"
#include <iostream>
#include <random>
#include <ctime>
const int stuCount = 10;

// 生成学生ID
std::string generateStuID(int num)
{
    // 前几位
    std::string result = "E20202";

    // 后2位
    if (num < 10)
    {
        result += "0";
    }
    result += std::to_string(num);

    return result;
}

// 生成学生姓名
std::mt19937 gen2((unsigned int)time(NULL));
std::string generateStuName(int num)
{
    // 汉字，那就用char二维数组记录。姓氏
    const char surname[24][10] = {"赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "楮", "卫", "蒋", "沈", "韩", "杨", "朱", "秦", "尤", "许", "何", "吕", "施", "张"};
    // 名
    const char firstName[24][10] = {"浩然", "思琪", "雨轩", "若云", "曦", "傲天", "强", "梦","如奕","明轩","天翊","玉枫","景铄","一铭","龙", "旭乐", "志南", "韵","昕","玥","菡","莹然","夕","溪瑶"};

    std::random_device rd; // 随机数发生器
    std::uniform_int_distribution<int> distribution1(0, 23);
    std::uniform_int_distribution<int> distribution2(0, 23);

    std::string result = surname[distribution1(gen2)];
    result += firstName[distribution2(gen2)];

    return result;
}

std::vector<Student> stu_init()
{
    std::vector<Student> stu(stuCount);
    for (int i = 0; i < stuCount; i++)
    {
        stu[i].studentID = generateStuID(i);
        stu[i].name = generateStuName(i);
    }
    return stu;
}
